/**
 * Created with JetBrains PhpStorm.
 * User: MeRo
 * Date: 17.09.13
 * Time: 19:19
 * To change this template use File | Settings | File Templates.
 */

$.fn.getGridlyData = function() {
    var data = [];
    $(this).find('.brick').each(function(k, v) {
        var left        = parseInt($(this).css('left').replace('px', '')) / 160;
        if (data[left] == undefined) {
            data[left] = [];
        }
        data[left][parseInt($(this).css('top').replace('px', '')) / 160] = jQuery.parseJSON($(this).find('.data').html());
    });

    //data = JSON.stringify(data); array to json
    return data;
}
